package com.hundsun.cprs.yyt.service.trade.enums;

import java.util.HashMap;
import java.util.Map;

public enum EnumEntustFrom {

    FROM_USER(1, "会员委托"),

    FROM_PLATFORM(2, "平台委托"),

    BATCH_INSERT(3,"批量导入");

    EnumEntustFrom(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private Integer code;

    private String  desc;

    /**
     * 全局索引池
     */
    private static Map<String, EnumEntustFrom> pool = new HashMap<String, EnumEntustFrom>();
    static {
        for (EnumEntustFrom et : EnumEntustFrom.values()) {
            pool.put(et.code + "", et);
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> enumDataMap = new HashMap<Integer, String>();
        for (EnumEntustFrom type : EnumEntustFrom.values()) {
            enumDataMap.put(type.getCode(), type.getDesc());
        }
        return enumDataMap;
    }

    public static Map<String, EnumEntustFrom> toStringMap() {
        return pool;
    }
}
